import pandas as pd
import re
import csv
def calculate_custom_sum(lst, index_array):
    total_sum = 0
    for i in range(len(lst)):
        if i in index_array:
            total_sum += int(lst[i])
        else:
            total_sum += 5 - int(lst[i])
    return total_sum
with open('data-scoreup.csv','r') as data:
  with open('ddddd.csv','a+',newline="") as ddd:
    w=csv.writer(ddd)
    r=data.readline().split(",")
    r=data.readline().split(",")
    while(r):
        if(len(r)>100):
            if "NULL" in r[0:50]:
                continue
         
            ext=calculate_custom_sum(r[0:10],list([0,2,4,6,8]))
            est=calculate_custom_sum(r[10:20],list([1,3]))
            agr=calculate_custom_sum(r[20:30],list([1,3,5,7,8,9]))
            csn=calculate_custom_sum(r[30:40],list([0,2,4,6,8,9]))
            opn=calculate_custom_sum(r[40:50],list([0,2,4,6,7,8,9]))
            temp=[ext,est,agr,csn,opn,r[100:]]
            w.writerow(temp)
        r=data.readline().split(",")





        
    
             
             

            

    
     
     


        